home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / scrn11 / scrnlib.doc < prev    next >
Text File  |  1987-06-30  |  37KB  |  1,066 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                                       SCRNLIB  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.            
  35.                                   By Dave Millis     
  36.                                      P.O. Box  2371
  37.                                      Glenview, Illinois 60025
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.           Copyright 1987 by Dave Millis.  All rights reserved
  56.  
  57.  
  58.  
  59.                                                                           2
  60.           SCRNLIB release 1
  61.  
  62.           INTRODUCTION
  63.  
  64.                SCRNLIB is a library of text screen routines for the Micro-
  65.           soft and Turbo C compilers.  Most of the routines were written in
  66.           assembly language for the optimum in speed and performance. 
  67.           These routines remedy some of the deficiencies of C by allowing
  68.           screen output in color and allowing for the use of windows.  
  69.  
  70.                I was a Turbo Pascal user for two years before I started to
  71.           program heavily in C on the PC.  In February 1987, I purchased
  72.           the Microsoft 'C' Compiler 4.0.  I always appreciated the
  73.           flexibility and sheer power of C, but I missed the many simple
  74.           text output functions of Turbo Pascal.  I then decided to write
  75.           the functions I needed.  After working on this part-time for
  76.           several months I collected all the routines into a file called
  77.           SCRNLIB.LIB.  These routines were tested by several friend and
  78.           co-workers who offered some constructive criticism and
  79.           suggestions.  They even found a couple of bugs.  With the
  80.           correction of the bugs; the addition of some procedures; and some
  81.           minor modifications so the routines will work with both Turbo C
  82.           and the Microsoft 'C' Compiler, SCRNLIB release 1 was completed.
  83.  
  84.                I am an active programmer and I have a bachelor's degree in
  85.           computer science.  I am now primarily using C and assembly and I
  86.           generate a multitude of routines that can be beneficial to many
  87.           programmers.  I am using SCRNLIB to see if there is an interest
  88.           in these fast, efficient routines.  If there is, later versions
  89.           will include more direct memory access screen procedures, more
  90.           sophisticated windowing, and many other helpful routines.
  91.  
  92.                By now you might be asking-
  93.  
  94.           DO I NEED SCRNLIB?
  95.  
  96.                Well, I feel SCRNLIB is the best way to output text to the
  97.           screen with a color attribute.  By "color attribute" I mean the
  98.           method that the characters are displayed on the screen.  For
  99.           monochrome display cards, this means underlined, bold, and
  100.           inverse video text.  The C programming langauge does not provide
  101.           these functions in a nice workable way.  One can use ANSI to help
  102.           with screen manipulations, however this would require ANSI.SYS be
  103.           installed on every machine using these programs and the output
  104.           would be slower than if SCRNLIB was used.  The SCRNLIB routines
  105.           do not require ANSI.SYS be installed and should run on all
  106.           systems with standard video hardware (ie. MA, HMA, CGA, EGA)
  107.           including most third party video boards.  Since these routines
  108.           were written in assembly, they run as fast as possible.  There is
  109.           no doubt that other software producers will develope libraries or
  110.           C source code collections that will allow for some of these same
  111.           functions; however, If they are not written in assembly, they
  112.  
  113.           Software and Documentation Copyright 1987 by Dave Millis
  114.  
  115.                                                                           3
  116.           SCRNLIB release 1
  117.  
  118.           will not be as fast as SCRNLIB's routines.
  119.  
  120.                SCRNLIB also allows other input/output operations.  For
  121.           example, inpstr is a function that enables string inputs from the
  122.           keyboard.  This function is necessary because the input functions
  123.           in standard C does not allow echoing of the input with the
  124.           currently set color attribute.
  125.  
  126.                If Windows are desired, SCRNLIB provides a great way to
  127.           generate and maintain them.
  128.  
  129.           WINDOWING
  130.  
  131.                SCRNLIB provides for a specified area of the screen to be
  132.           the only area written to or effected by many screen operations. 
  133.           The area, referred to from now on as the active window, is easily
  134.           defined and "remembered" by the program.  Once defined, the
  135.           active window can be cleared, written to, and scrolled up and
  136.           down using the normal screen functions provided in SCRNLIB
  137.           without effecting the rest of the screen.  Output functions, such
  138.           as printsh and putsch, continue output at the beginning of the
  139.           next line of the active window when the right end of the active
  140.           window is encountered.  The windows can also be saved and
  141.           restored later anywhere on the screen. 
  142.  
  143.           Window Example:
  144.                Say you want to open a window 30 x 5 characters in size to
  145.           display a message and ask for input from the user of your
  146.           program.  Lets also say you want this window to disappear and
  147.           restore the screen to its original condition when you're done
  148.           with it.  This is what you would do:
  149.  
  150.           1) Save the current screen below where the window will go.  This
  151.              is done with the scrnsav command:
  152.  
  153.                int x;               /*number of char. in the input string*/
  154.                char undrwindo[152]; /*define a character string large      
  155.                                      enough to save the screen in*/
  156.  
  157.            --> scrnsav(undrwindo,25,10,54,14); /*save portion of screen */
  158.                getpos();   /* read current cursor position (into global    
  159.                               variables xposn and yposn  */
  160.  
  161.              see the Command section for a full explanation of all commands
  162.  
  163.           2) Next, set the active window:
  164.  
  165.                window(25,10,54,14,0);/*declare active window w/ no border*/
  166.  
  167.           3) To have this window stand out from the rest of the screen, we
  168.  
  169.           Software and Documentation Copyright 1987 by Dave Millis
  170.  
  171.                                                                           4
  172.           SCRNLIB release 1
  173.  
  174.              will change the foreground and background color attributes:
  175.  
  176.                setattr(1,4);  /* blue on red */
  177.                cls();
  178.                gotoxy(27,12);
  179.  
  180.              This sets the color attribute, clears the 30 x 5 active screen
  181.              and positions the cursor over 2 and down 2 form the top left
  182.              corner of the window.  At this point the screen looks
  183.              unchanged except for a 30 x 5 red square in the center.
  184.  
  185.           4) Writing the message is straight forward:
  186.  
  187.                printsh("What is your mother's maiden name? ");
  188.  
  189.              This is not the best way to present this message, but it
  190.              illustrates how the windows work.  The problem is the message
  191.              is longer than the width of the screen.  What happens is the
  192.              sentence up through "maiden" is printed, then "name? " is
  193.              printed on the next line starting at 25,13.
  194.  
  195.           5) Input is handled with the inpstr function:
  196.  
  197.                x=inpstr(mommaname);
  198.  
  199.           6) Finally, now that we have the information we require, we need 
  200.              to restore the screen to its original condition and position
  201.              to its old position:
  202.  
  203.                scrnrst(undrwindo,25,10);
  204.                gotoxy(xposn,yposn);
  205.  
  206.  
  207.              While windows are not an extensively used function in a lot of
  208.           programs, the functions in SCRNLIB provides a lot of practical
  209.           applications.  For example, If you want to generate a program
  210.           that actively uses the entire screen except for the 25 row where
  211.           the function keys or other information is always displayed, an
  212.           active window 80 x 24 can be defined.  This way only the top 24
  213.           rows will be written to and when the bottom of the active window
  214.           is reached the top 24 rows will scroll up, leaving row 25
  215.           unchanged.
  216.  
  217.  
  218.           USING SCRNLIB WITH TURBO-C
  219.  
  220.                When compiling a program in the integrated environment,
  221.           SCRNLIBx.LIB must be specified in a project file.  For example,
  222.           to run DEMO.C with the small memory model, DEMO.PRJ would look
  223.           like:
  224.  
  225.           Software and Documentation Copyright 1987 by Dave Millis
  226.  
  227.                                                                           5
  228.           SCRNLIB release 1
  229.  
  230.  
  231.                DEMO
  232.                \TURBOC\LIB\SCRNLIBS.LIB
  233.  
  234.           (assuming that the SCRNLIBx libraries are in the \TURBOC\LIB
  235.           directory)
  236.  
  237.           MORE TECHNICAL INFORMATION
  238.  
  239.                In release 1, all but three of the routines were written in
  240.           assembly, using the Microsoft Macro Assembler 4.0.  In the
  241.           interest of speed and efficiency, the error checking was kept to
  242.           a minimum, as is typical of C.  It is up to the programmer to
  243.           make sure that the proper variables are passed and the proper
  244.           amount of memory is allocated for the arrays used.  See the
  245.           section of commonly made errors for an explanation of the errors
  246.           most often made in using SCRNLIB.
  247.  
  248.                In all routines that require an X and Y location, it must be
  249.           noted that the top left corner of the screen is 0,0 (not 1,1). 
  250.           This means the bottom right corner is 79,24.
  251.  
  252.                There are several global variables used by SCRNLIB that are
  253.           accessible to the programmer too:  oldcurs, scxlow, scxhigh,
  254.           scylow, scyhigh, txtattr, xposn and yposn.  These keywords should
  255.           not be used in other contexts.  There exact meanings are as
  256.           follows:
  257.  
  258.                oldcurs contains the start and stop scan lines of the cursor
  259.           saved with the cursoff function and used by the curson function. 
  260.           It is uninitialized at the start.
  261.  
  262.                scxlow and scylow define the upper left corner of the active
  263.           window.  scxhigh and scyhigh define the location of the lower
  264.           right corner of the active window.  The default values defined in
  265.           the header file are: scxlow=0, scylow=0, scxhigh=79, scyhigh=24; 
  266.           this is just the entire screen.  These values can be changed
  267.           individually in a program, or through the window command.
  268.  
  269.                txtattr contains the current text color attribute (default
  270.           is 07).     
  271.  
  272.                xposn and yposn are the current X and Y position of the
  273.           cursor set when the function getpos is executed.  These
  274.           variables, along with the getpos function, exist for the use of
  275.           the programmer to easily get the cursor location.  xposn and
  276.           yposn are only changed by the getpos function and therefore can
  277.           be used to store the cursor location.
  278.  
  279.  
  280.  
  281.           Software and Documentation Copyright 1987 by Dave Millis
  282.  
  283.                                                                           6
  284.           SCRNLIB release 1
  285.  
  286.           COMMONLY MADE ERROR WITH SCRNLIB
  287.  
  288.                1) Probably the most common problem results from not declar-
  289.           ing string variables large enough to hold all the data put in
  290.           them.  This over writes other portions of the program and causes
  291.           it to crash.  This usually occurs with the scrnsav function and
  292.           one should carefully read about this function before using it.
  293.  
  294.                2) A stack overflow is a common problem when numerous screen
  295.           saves are preformed.  This is because many local variables are
  296.           stored in the stack area and the screen data strings are very
  297.           large.  This problem is also not detected using the default
  298.           settings in Turbo-C.  If your program behaves peculiarly, turn on
  299.           the stack overflow checking in the Code generation menu in the
  300.           Options-Compiler menu.  The easiest way to correct this problem
  301.           is to use global arrays (ie. declare the arrays outside of any
  302.           functions-this includes function main).  If the arrays aren't too
  303.           large, you can use the MS link and use the /stack option to
  304.           increase the size of the stack.  I have not had success using
  305.           EXEMOD to increase the size of the stack on   Turbo-C (TLINK
  306.           linked) files with the stack overflow checking on.
  307.            
  308.                3) Trying to address the last column or the last row of the
  309.           screen with 80 or 25 respectively does not work since the bottom
  310.           right corner is 79,24.  This is because the first column and the
  311.           first row are both defined as zero (0).
  312.  
  313.                4) Forgetting to include the SCRNLIB.H file at the beginning
  314.           of the program can cause problems.
  315.  
  316.           DISCLAIMER
  317.  
  318.                I do not guarantee that the SCRNLIB functions will do
  319.           anything.  However, I have tried to write the best, most effi-
  320.           cient, and most portable functions that I could, and have tested
  321.           them extensively on eight different makes and models of MS-DOS
  322.           based microcomputers.  I also do not guarantee that SCRNLIB will
  323.           not do anything harmful to anything nor anybody.  Any discrep-
  324.           ancies or problems should be brought to my attention so that I
  325.           could improve upon them before the next release.  At this time, I
  326.           believe SCRNLIB is in perfect working condition.  THE USERS OF
  327.           SCRNLIB ARE SOLELY RESPONSIBLE ITS EFFECTS IN THEIR CODE. 
  328.  
  329.           TRADE MARKS
  330.  
  331.           Turbo Pascal and Turbo C are registered trade marks of Borland
  332.           International, Inc.
  333.  
  334.           MS-DOS, MS, Microsoft, and Microsoft 'C' Compiler are a
  335.           registered trade mark of Microsoft Corp.
  336.  
  337.           Software and Documentation Copyright 1987 by Dave Millis
  338.  
  339.                                                                           7
  340.           SCRNLIB release 1
  341.  
  342.           REFERENCE
  343.  
  344.                Even though these routines were written in assembly they
  345.           conform to the C calling standard and are used as normal C
  346.           procedures and functions.  The names have been chosen to describe
  347.           the function and so they appear as a natural extension of the C
  348.           language.
  349.  
  350.           **************************
  351.           beep
  352.  
  353.           PROTOTYPE:
  354.  
  355.                void beep(void);
  356.  
  357.           DESCRIPTION:
  358.  
  359.                I admit this is a very unimpressive procedure to start with,
  360.           but I do use it quite often.  This routine simply sound the
  361.           standard 800 Hz sound for 1/4 seconds.
  362.  
  363.           **************************
  364.           cls
  365.  
  366.           PROTOTYPE:
  367.  
  368.                void cls(void);
  369.  
  370.           DESCRIPTION:
  371.  
  372.                This clears the active screen using the current attributes.
  373.  
  374.  
  375.           **************************
  376.           cursoff
  377.  
  378.           PROTOTYPE:
  379.  
  380.                void cursoff(void);
  381.  
  382.           DESCRIPTION:
  383.  
  384.                This turns off the cursor and saves the old cursor type in
  385.           the global variable oldcurs.  This allows for the old cursor to
  386.           be restored.  Also allowed is the ability to turn off the cursor
  387.           then change to a different form of cursor, using setcurs, then
  388.           use curson to restore the original cursor.  Remember that cursoff
  389.           must be executed before curson will restore the old cursor.
  390.  
  391.           also see: curson,setcurs
  392.  
  393.           Software and Documentation Copyright 1987 by Dave Millis
  394.  
  395.                                                                           8
  396.           SCRNLIB release 1
  397.  
  398.           **************************
  399.           curson
  400.  
  401.           PROTOTYPE:
  402.  
  403.                void curson(void);
  404.  
  405.           DESCRIPTION:
  406.  
  407.                Restore the cursor stored in the global variable oldcurs.
  408.  
  409.           also see: cursoff,setcurs
  410.  
  411.  
  412.           **************************
  413.           getkey
  414.  
  415.           PROTOTYPE:
  416.  
  417.                char getkey(void);
  418.  
  419.           DESCRIPTION:
  420.  
  421.                This get a character from the keyboard.
  422.  
  423.  
  424.           **************************
  425.           getpos
  426.  
  427.           PROTOTYPE:
  428.  
  429.                void getpos(void);
  430.  
  431.           DESCRIPTION:
  432.  
  433.                Gets the current position of the cursor and puts the X and Y
  434.           positions in the global variables xposn and yposn respectively. 
  435.           These two variables, xposn and yposn, are only affected by this
  436.           function (and a direct assignment), so they can be used to
  437.           reference the position where getpos was last executed.
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.           Software and Documentation Copyright 1987 by Dave Millis
  450.  
  451.                                                                           9
  452.           SCRNLIB release 1
  453.  
  454.           **************************
  455.           gotoxy
  456.  
  457.           PROTOTYPE:
  458.  
  459.                void gotoxy(int xloc,int yloc);
  460.  
  461.           DESCRIPTION:
  462.  
  463.                gotoxy positions the cursor at the screen position defined
  464.           by xloc and yloc.  The X position and Y position are xloc and
  465.           yloc respectively.  This function is not limited by the active
  466.           screen.
  467.  
  468.  
  469.           **************************
  470.           inpstr
  471.  
  472.           PROTOTYPE:
  473.  
  474.                int inpstr(char *str);
  475.  
  476.           DESCRIPTION:
  477.  
  478.                inpstr gets a string input from the keyboard and echoes the
  479.           input on the screen using the current attributes.  The string of
  480.           input is stored in *str.  The returned integer is the number of
  481.           characters entered.
  482.  
  483.  
  484.           **************************
  485.           keywait
  486.  
  487.           PROTOTYPE:
  488.  
  489.                char keywait(void);
  490.  
  491.           DESCRIPTION:
  492.  
  493.                keywait clears the keyboard then waits for a single
  494.           keystroke from the keyboard.  The returned character is the ASCII
  495.           value of the first byte of input from the key board.  If the key
  496.           pressed is a special function key, such as the function keys or
  497.           the arrow keys, the return character will be 00h.  Since these
  498.           special keys input a series of two characters, a character will
  499.           remain in the keyboard buffer and the function getkey can be used
  500.           to get the second character. 
  501.  
  502.  
  503.  
  504.  
  505.           Software and Documentation Copyright 1987 by Dave Millis
  506.  
  507.                                                                          10
  508.           SCRNLIB release 1
  509.  
  510.           **************************
  511.           movxy
  512.  
  513.           PROTOTYPE:
  514.  
  515.                void movxy(int xdis,int ydis);
  516.  
  517.           DESCRIPTION:
  518.  
  519.                This moves the cursor vertically and horizontally from its
  520.           current position.  xdis and ydis are the displacements from the
  521.           current cursor position in the X and Y position respectively.
  522.  
  523.  
  524.  
  525.           **************************
  526.           printmch
  527.  
  528.           PROTOTYPE:
  529.  
  530.                void printmch(char *chr,int numprn);
  531.  
  532.           DESCRIPTION:
  533.  
  534.                printmch prints a single character a specified number of
  535.           times horizontally on the screen using the current attributes. 
  536.           If the number of characters exceeds the space to the right side
  537.           of the screen the remaining characters will rap around the
  538.           beginning of the next line.  If the printing proceeds to the
  539.           bottom right corner of the screen, the screen will not scroll and
  540.           the remaining characters will not be printed.  This procedure is
  541.           not limited by the active screen.  *chr is the character to be
  542.           printed and numprn is the number of times *chr is to be printed.
  543.           This function, along with printmcv, was primarily written to draw
  544.           frames and lines on the screen, usually outside the active
  545.           screen.  
  546.                printmch, along with all the printing routines, uses the
  547.           BIOS to output to the screen.  In future releases, there will be
  548.           the option of doing output using the BIOS or direct memory
  549.           access.  There will be a global variable that will dictate which
  550.           method is to be used.  This variable can be changed in the
  551.           program, so a command line option can be added to your programs
  552.           to set the output method.
  553.  
  554.           also see: printmcv
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.           Software and Documentation Copyright 1987 by Dave Millis
  562.  
  563.                                                                          11
  564.           SCRNLIB release 1
  565.  
  566.           **************************
  567.           printmcv
  568.  
  569.           PROTOTYPE:
  570.  
  571.                void printmcv(char *chr, int numprn);
  572.  
  573.           DESCRIPTION:
  574.  
  575.                printmcv prints a single character a specified number of
  576.           times vertically on the screen using the current attributes.  If
  577.           the number of characters exceeds the space to the down the rest
  578.           of the screen, the remaining characters are not printed.  *chr is
  579.           the character to be printed and numprn is the number of times
  580.           *chr is to be printed.  This procedure is not limited by the
  581.           active screen.  This function, along with printmch, was primarily
  582.           written to draw frames and lines on the screen, usually outside
  583.           the active screen.
  584.  
  585.           also see:printmcv
  586.  
  587.  
  588.           **************************
  589.           printsh
  590.  
  591.           PROTOTYPE:
  592.  
  593.                void printsh(char *str);
  594.  
  595.           DESCRIPTION:
  596.  
  597.                printsh prints a string horizontally in the active window
  598.           using the current attributes.  If the end of the active window is
  599.           reached, the string continues on the next line of the active
  600.           window.  If the end of the active window is reached the window
  601.           will scroll up and the rest of the string will be printed.  All
  602.           of the back slash (\) functions are supported as they are in the
  603.           standard C printf procedure;  however, the % functions for
  604.           printing numbers and other strings are not supported yet.  To
  605.           generate output in the same fashion as printf the sprintf
  606.           function can be used alone with printsh:
  607.  
  608.                sprintf(txt,"a=%d  b=%d",a,b);
  609.                printsh(txt);
  610.  
  611.           Remember to include stdio.h when using sprintf.  
  612.                Support for numbers and additional strings is currently one
  613.           of my primary projects.
  614.            
  615.           also see printsv,putsch
  616.  
  617.           Software and Documentation Copyright 1987 by Dave Millis
  618.  
  619.                                                                          12
  620.           SCRNLIB release 1
  621.  
  622.           **************************
  623.           printsv
  624.  
  625.           PROTOTYPE:
  626.  
  627.                void printsv(char *str);
  628.  
  629.           DESCRIPTION:
  630.  
  631.                printsv prints the given string vertically in the active
  632.           screen using the current attributes.  If there is not a enough
  633.           space from the current cursor position to the bottom of the
  634.           window the remainder of the string is truncated.  The only back
  635.           slash commands supported are the \a and \b.  Like the printsh
  636.           routine, the % format specifications are not supported, yet.
  637.  
  638.           also see printsh,putsch
  639.  
  640.           **************************
  641.           putsch
  642.  
  643.           PROTOTYPE:
  644.  
  645.                void putsch(char *chr);
  646.  
  647.           DESCRIPTION:
  648.  
  649.                putsch prints a single character at the cursor position with
  650.           the current attribute.  This function only works in the active
  651.           window and advances to the next line of the active window after
  652.           printing a character in the last active column.  All the back
  653.           slash commands are supported.
  654.  
  655.           also see printsh,printsv
  656.  
  657.           **************************
  658.           scrldn
  659.  
  660.           PROTOTYPE:
  661.  
  662.                void scrldn(int);
  663.  
  664.           DESCRIPTION:
  665.  
  666.                scrldn scrolls the active screen down the number of rows
  667.           specified by int.  The current background attribute is used for
  668.           the blank lines added to the top of the screen as the screen
  669.           scrolls.
  670.  
  671.           also see scrlup
  672.  
  673.           Software and Documentation Copyright 1987 by Dave Millis
  674.  
  675.                                                                          13
  676.           SCRNLIB release 1
  677.  
  678.           **************************
  679.           scrlup
  680.  
  681.           PROTOTYPE:
  682.  
  683.                void scrlup(int);
  684.  
  685.           DESCRIPTION:
  686.  
  687.                scrlup scrolls the active screen up the number of rows
  688.           specified by int.  The current background attribute is used for
  689.           the blank lines added to the bottom of the screen.
  690.  
  691.           also see scrldn
  692.  
  693.  
  694.           **************************
  695.           scrnoff
  696.  
  697.           PROTOTYPE:
  698.  
  699.                void scrnoff();
  700.  
  701.           DESCRIPTION:
  702.  
  703.                scrnoff blanks the screen.
  704.  
  705.           also see scrnon
  706.           **************************
  707.           scrnon
  708.  
  709.           PROTOTYPE:
  710.  
  711.                void scrnon();
  712.  
  713.           DESCRIPTION:
  714.  
  715.                scrnon turns the screen back on after a scrnoff has been
  716.           executed.
  717.  
  718.           also see scrnoff
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.           Software and Documentation Copyright 1987 by Dave Millis
  730.  
  731.                                                                          14
  732.           SCRNLIB release 1
  733.  
  734.           **************************
  735.           scrnrst
  736.  
  737.           PROTOTYPE:
  738.  
  739.                void scrnrst(char *str,int xl,int yl);
  740.  
  741.           DESCRIPTION:
  742.  
  743.                scrnrst restores a saved screen that was saved with scrnsav
  744.           or scrnsavd.  str is the character array that stores the screen
  745.           information, xl and yl makeup the x and y position of the top
  746.           left corner of where the window is to be restored.
  747.  
  748.                scrnrst(d) can also be used with scrnsav(d) to move windows.
  749.           A window or an area of the screen can be saved and then restored
  750.           at a different location by specifying a different xl and yl in
  751.           the restore cammand.  The dimensions of the screen remain the
  752.           same as they are stored in the data string.
  753.  
  754.           also see scrnrstd,scrnsav,scrnsavd
  755.  
  756.  
  757.           **************************
  758.           scrnrstd
  759.  
  760.           PROTOTYPE:
  761.  
  762.                void scrnrstd(char *str,int xl,int yl);
  763.  
  764.           DESCRIPTION:
  765.  
  766.                scrnrstd works exactly like scrnrst.  The only difference is
  767.           that scrnrstd uses direct memory access to restore the screen. 
  768.           This provides a great speed enhancement over scrnrst, which uses
  769.           the BIOS, but it may not be as portable to other computers.
  770.  
  771.           also see scrnrst,scrnsav,scrnsavd
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.           Software and Documentation Copyright 1987 by Dave Millis
  786.  
  787.                                                                          15
  788.           SCRNLIB release 1
  789.  
  790.           **************************
  791.           scrnsav
  792.  
  793.           PROTOTYPE:
  794.  
  795.                void scrnsav(chr *str,int xl,int yl,int xh,int yh);
  796.  
  797.           DESCRIPTION:
  798.  
  799.                scrnsav saves a rectangular portion of the screen.  The
  800.           information from this portion of the screen is stored in the
  801.           character string str.  xl and yl define the upper left corner and
  802.           xh and yh define the lower right corner of the rectangle. 
  803.  
  804.                Calculation to determine the size of *str:
  805.  
  806.                size = (2 x (xh - xl + 1) x (yh - yl + 1)) + 2)
  807.  
  808.           This is simply the size of the window times 2, plus 2.  The
  809.           reason for this is 2 bytes must be stored for each character on
  810.           the screen, one for the character and one for the attribute, then
  811.           the first 2 bytes of the string contain the size of the array
  812.           (more specifically the X size and Y size).
  813.  
  814.                It is VERY important that *str is large enough to hold all
  815.           the data.  Unpredictable results will occur if this space is too
  816.           small.  It does not make any difference if this space is too
  817.           large.
  818.  
  819.           also see scrnrst,scrnrst,scrnsavd
  820.  
  821.  
  822.           **************************
  823.           scrnsavd
  824.  
  825.           PROTOTYPE:
  826.  
  827.                void scrnsavd(chr *str,int xl,int yl,int xh,int yh);
  828.  
  829.           DESCRIPTION:
  830.  
  831.                scrnsavd works exactly like scrnsav.  The only difference is
  832.           that scrnsavd uses direct memory access to save the screen.  This
  833.           provides a great speed enhancement over scrnsav, which uses the
  834.           BIOS, but it may not be as portable to other computers.
  835.  
  836.           also see scrnrst,scrnrstd,scrnsav
  837.  
  838.  
  839.  
  840.  
  841.           Software and Documentation Copyright 1987 by Dave Millis
  842.  
  843.                                                                          16
  844.           SCRNLIB release 1
  845.  
  846.           **************************
  847.           setattr
  848.  
  849.           PROTOTYPE:
  850.  
  851.                void setattr(int fgrnd,int bgrnd);
  852.  
  853.           DESCRIPTION:
  854.  
  855.                setattr sets the current color attribute to be used for the
  856.           screen output functions.  fgrnd is an integer from 0-15 that
  857.           specfies the foreground color.  These numbers correspond to:
  858.  
  859.             0 - Black                    8 - Gray   
  860.             1 - Blue   (underline)       9 - Bright Blue (bright underline)
  861.             2 - Green                   10 - Bright Green
  862.             3 - Cyan                    11 - Bright Cyan
  863.             4 - Red                     12 - Bright Red
  864.             5 - Magenta                 13 - Bright Magenta
  865.             6 - Brown                   14 - Yellow or Bright Brown
  866.             7 - White                   15 - Bright White
  867.  
  868.           The descriptions in parentheses are for monochrome cards.
  869.                bgrnd is an integer also from 0-15 where 0-7 specifies the
  870.           background color.  0-7 correspond to the same colors as the
  871.           foreground colors above.  8-15 correspond to a the same
  872.           background color as 0-7 respectively, but causes the foreground
  873.           color to blink.  
  874.  
  875.  
  876.           **************************
  877.           setcurs
  878.  
  879.           PROTOTYPE:
  880.  
  881.                void setcurs(int curstrt, int curstop);
  882.  
  883.           DESCRIPTION:
  884.  
  885.                setcurs set the cursor type.  curstrt is the first scan line
  886.           and curstop is the final scan line that makes up the cursor. 
  887.                The cursor is defined by the number and positions of lines
  888.           that make it up.  For example, the cursor on a CGA is made up of 
  889.           lines 6 and 7 (curstrt=6, curstop=7).  A box cursor on a CGA
  890.           would be: curstrt=0, curstop=7.  The total number of line on a
  891.           monochrome is 14 (0-13).  If curstrt is larger than curstop, the
  892.           scan lines will wrap around and the cursor will appear as two
  893.           sets of lines.
  894.  
  895.           also see cursoff,curson
  896.  
  897.           Software and Documentation Copyright 1987 by Dave Millis
  898.  
  899.                                                                          17
  900.           SCRNLIB release 1
  901.  
  902.           **************************
  903.           window
  904.  
  905.           PROTOTYPE:
  906.  
  907.                void window(int xl,xin yl,int xh,int yh,int brdrtype);
  908.  
  909.           DESCRIPTION:
  910.  
  911.                window sets the active window.  xl and yl define the top
  912.           left corner and xh and yh are the lower right corner of the
  913.           window.  brdrtype is the type of border that will be drawn around
  914.           the window: 0 is no border, 1 is a single line boarder, and 2 is
  915.           a double line border.  This border is drawn OUTSIDE of the active
  916.           screen.  This means that if a border is specified, the total
  917.           boundaries of the screen will be: xl-1,yl-1,xh+1,yh+1.  One word
  918.           of warning, do not try and draw a border around a window that has
  919.           an edge of the ACTIVE screen as one of its borders.  This will
  920.           usually cause the border to be printed at the other edge of the
  921.           screen (It wraps around).
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.           Software and Documentation Copyright 1987 by Dave Millis
  954.  
  955.                                                                          18
  956.           SCRNLIB release 1
  957.  
  958.           REGISTRATION
  959.  
  960.                I wrote SCRNLIB with the purpose of making programming a
  961.           little bit easier and a little bit more fun.  With this in mind,
  962.           I would like to encourage everyone who uses SCRNLIB to freely
  963.           copy it and upload it to other bulletin boards providing that: 1)
  964.           No fee is charged for such copying and distribution and 2)
  965.           SCRNLIB is distributed ONLY in its ORIGINAL form, unmodified in
  966.           anyway.  
  967.  
  968.                I do ask, however, that those who find SCRNLIB useful become
  969.           registered users and obtain a license for its use.  Only
  970.           registered users may use SCRNLIB in the development of their own
  971.           programs and may sell or distribute these programs to others. 
  972.           Registered users will also receive technical support and will be
  973.           informed of any major developments and improvements.
  974.  
  975.                To register, just send $10 along with the attached
  976.           registration form and in return I will mail you : 1) the Latest
  977.           Version of SCRNLIB including libraries that work with each of the
  978.           Small, Medium, Compact, and Large memory modules. 2) The Latest
  979.           Documentation. 
  980.  
  981.                If you try SCRNLIB and feel it's not quite for you, please
  982.           still send us your opinion of the product and any suggestions.  I
  983.           welcome and encourage any input anyone has. 
  984.           ________________________________________________________________
  985.           cut along dashed line and mail with check for $10 per license
  986.           and $1 postage and shipping for each disk requested to DAVE
  987.           MILLIS PO BOX 2371, GLENVIEW, ILLINOIS  60025
  988.           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  989.  
  990.           I HAVE ENCLOSED $_______ FOR _____ COPIES OF SCRNLIB TO BE
  991.           REGISTERED  TO:
  992.  
  993.           NAME_______________________________
  994.  
  995.           COMPANY____________________________
  996.            
  997.           ADDRESS________________________________________________________
  998.  
  999.           CITY_______________________________
  1000.  
  1001.           STATE__________ ZIP CODE____________
  1002.  
  1003.           PHONE (  )______________________    (  )_______________________
  1004.  
  1005.           CURRENT RELEASE IN YOUR POSSESSION _________
  1006.  
  1007.           ___ PLEASE CONTACT ME ABOUT QUANTITY PRICING OR SITE LICENSING.
  1008.  
  1009.           Copyright 1987 by Dave Millis.  All rights reserved.
  1010.  
  1011.                                                                          19
  1012.           SCRNLIB release 1
  1013.  
  1014.           FUTURE RELEASES
  1015.  
  1016.                All the printing routines use the BIOS to output to the
  1017.           screen.  In future releases, there will be the option of doing
  1018.           output using the BIOS or direct memory access.  There will be a
  1019.           global variable that will dictate which method is to be used. 
  1020.           This variable can be changed in the program, so a command line
  1021.           option can be added to your programs to set the output method.
  1022.  
  1023.                I currently have several more functions that I have not
  1024.           tested thoroughly enough yet to include with this release.  They
  1025.           include functions that:  set the border color; check and set the
  1026.           video mode (SCRNLIB functions work in 40 character mode also);
  1027.           allow for a max number of characters to be input with the string
  1028.           input function; support more sophisticated windowing; ... and
  1029.           many more.
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.           Copyright 1987 by Dave Millis.  All rights reserved.
  1066.